package challenge;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;

/**
 * Created by Tzachi on 18/10/2014.
 */
public class Test {
    void increment(int[] i){
        i[i.length - 1]++;

        LinkedList<String> l = new LinkedList<>();
    }

    public static boolean isSumPossible(int[] a, int N){
        Set<Integer> set = new HashSet<>();
        for (int x : a){
            if (set.contains(N-x)){
                return true;
            }
            set.add(x);
        }
        return false;
    }

    public static void main(String[] args) {
        System.out.println(isSumPossible(new int[]{18,11,21,28,31,38,40,55,60,62}, 234));
    }
}
